package com.example.dao;

import com.example.domain.Department;
import com.example.domain.RewardPunish;
import com.example.domain.Staff;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author luo
 */
@Mapper
public interface StaffDao {
    /**
     * 查询所有员工信息
     * @return
     */
    @Select("select * from staff")
    public List<Staff> selectStaff();
    /**
     * 查询单个员工信息
     * @return
     */
    @Select("select * from staff where id = #{id}")
    public Staff selectStaffById(Integer id);

    /**
     * 动态sql 模糊查询
     * @param staff
     * @return
     */
    public List<Staff> selectStaffByName(Staff staff);

    /**
     * 添加员工
     * @param staff
     * @return
     */
    @Insert("insert into staff (name, sex, age, department, position, phone, time) values (#{name},#{sex},#{age},#{department},#{position},#{phone},#{time})")
    public int addStaff(Staff staff);

    /**
     * 更新员工信息
     *
     * @param staff
     * @return
     */
    @Update("update staff set name=#{name},sex=#{sex},age=#{age},department=#{department},position=#{position},phone=#{phone},time=#{time} where id = #{id}")
    public int updateStaff(Staff staff);

    /**
     * 根据id删除
     * @param id
     * @return
     */
    @Delete("delete from staff where id=#{id};")
    public int deleteStaff(Integer id);
}
